{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 在Python中，能够直接处理的数据类型有以下几种\n",
    "\n",
    "### 一 整数\n",
    "\n",
    "Python可以处理任意大小的整数，当然包括负整数，在Python程序中，整数的表示方法和数学上的写法一模一样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 100 -80 9\n"
     ]
    }
   ],
   "source": [
    "a1 = 1\n",
    "a2 = 100\n",
    "a3 = -80\n",
    "\n",
    "a4 = 9\n",
    "print(a1, a2, a3, a4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "整数可以进行加减乘除等数学运算。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "101\n",
      "-99\n",
      "3\n",
      "0.1\n"
     ]
    }
   ],
   "source": [
    "print(a1 + a2)\n",
    "print(a1 - a2)\n",
    "print(a1 * 3)\n",
    "print(a1 / 10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# = Root of number\n",
    "41 // 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "41 % 10 # = Remainder"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 练习\n",
    "\n",
    "a是5，b是10，c是18，S是a，b和c的总和，求解s的值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33\n",
      "900\n",
      "-867\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 求解 \n",
    "a=5\n",
    "b=10\n",
    "c=18\n",
    "s=a+b+c\n",
    "print(s)\n",
    "d=a*b*c\n",
    "print(d)\n",
    "e=s-d\n",
    "print(e)\n",
    "s+d\n",
    "1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 二 浮点数(float)\n",
    "\n",
    "浮点数也就是小数，之所以称为浮点数，是因为按照科学记数法表示时，一个浮点数的小数点位置是可变的，\n",
    "\n",
    "比如，1.23x10^9和12.3x10^8是相等的。浮点数可以用数学写法，如1.23，3.14，-9.01，等等。\n",
    "\n",
    "但是对于很大或很小的浮点数，就必须用科学计数法表示，把10用e替代，\n",
    "\n",
    "1.23x10^9就是1.23e9，12.3e8，\n",
    "\n",
    "0.000012可以写成1.2e-5，等等。\n",
    "\n",
    "整数和浮点数在计算机内部存储的方式是不同的，整数运算永远是精确的，而浮点数运算则可能会有四舍五入的误差。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "浮点数同样可以进行数学等运算。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "151.29000000000002\n",
      "-2.2525\n"
     ]
    }
   ],
   "source": [
    "c1 = 12.3\n",
    "c2 = -9.01\n",
    "print(c1**2)   # 平方 , 这里输出就会有不精确情况。\n",
    "print(c2 / 4)\n",
    "4**3 #= Square/Cube meter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 练习\n",
    "\n",
    "a是5.2，b是10.1，S是a和b的乘积，求解s的值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "52.52\n"
     ]
    }
   ],
   "source": [
    "# 求解\n",
    "a=5.2\n",
    "b=10.1\n",
    "s=a*b\n",
    "print(s)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "int= is not limited\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "37639453843549254712"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 三 字符串\n",
    "\n",
    "字符串是以''或 \"\" 括起来的任意文本，比如'abc'，\"xyz\"等等。\n",
    "\n",
    "请注意，''或\"\"本身只是一种表示方式，不是字符串的一部分，因此，字符串'abc' 只有a，b，c这3个字符。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d1= abc\n",
      "d2= edf\n",
      "d3= \n",
      "d4= 第一行 “abc”\n",
      "第二行 ‘edf’\n",
      "\n"
     ]
    }
   ],
   "source": [
    "d1 = 'abc'\n",
    "d2 = \"edf\"\n",
    "d3 = \"\"\n",
    "d4 = \"\"\"第一行 “abc”\n",
    "第二行 ‘edf’\n",
    "\"\"\"\n",
    "print('d1=',d1)\n",
    "print('d2=',d2)\n",
    "print('d3=',d3)\n",
    "print('d4=',d4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "abcabcabc\n"
     ]
    }
   ],
   "source": [
    "# 字符串也可以用加号\n",
    "d1 + d2\n",
    "d1 = 'abc'\n",
    "d2 = \"edf\"\n",
    "print(d1*3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "addition: can add the words together\n",
    "multipication:it will repeat the same thing if you times a number"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 练习\n",
    "\n",
    "按要求输出一句话: “我是龙王，我已经继承了1000亿身家，我将把你们都灭了！”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我是龙王，我已经继承了1000亿身家，我将把你们都灭了！\n",
      "我是龙王，我已经继承了1000亿身家，我将把你们都灭了！\n"
     ]
    }
   ],
   "source": [
    "a = \"我是龙王，\"\n",
    "\n",
    "b = \"我已经继承了\"\n",
    "\n",
    "c = 1000\n",
    "c=str(c) # It makes the int become a string\n",
    "d = \"亿身家，我将把你们都灭了！\"\n",
    "f=a+b+c+d\n",
    "print(f)\n",
    "print(f'{a}{b}{c}{d}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "you cannot put string and int together \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 延伸知识：Unicode\n",
    "\n",
    "Unicode通常用两个字节表示一个字符，原有的英文编码从单字节变成双字节，只需要把高字节全部填为0就可以。\n",
    "\n",
    "因为Python的诞生比Unicode标准发布的时间还要早，所以最早的Python只支持ASCII编码，普通的字符串'ABC'在Python内部都是ASCII编码的。\n",
    "\n",
    "Python在后来添加了对Unicode的支持，以Unicode表示的字符串用u'...'表示\n",
    "\n",
    "\n",
    "<strong>Python3.x默认就是Unicode</strong>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 四 布尔值\n",
    "\n",
    "布尔值和布尔代数的表示完全一致，一个布尔值只有True、False两种值，要么是True，要么是False，\n",
    "\n",
    "在Python中，可以直接用True、False表示布尔值（<b>请注意大小写</b>），也可以通过布尔运算计算出来。\n",
    "\n",
    "布尔值可以用and、or和not运算。\n",
    "\n",
    "#### and运算是与运算\n",
    "只有所有都为 True，and运算结果才是 True。\n",
    "And= All of the things are true and the result is true\n",
    "Only one thing is false and the result is false\n",
    "#### or运算是或运算\n",
    "只要其中有一个为 True，or 运算结果就是 True。\n",
    "Or= only one thing needs to be true and the result is true\n",
    "All of the things are false and the result is false\n",
    "#### not运算是非运算\n",
    "它是一个单目运算符，把 True 变成 False，False 变成 True。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "e1=True, e2=False, e3=False, e4=True, e5=False\n"
     ]
    }
   ],
   "source": [
    "e1 = True\n",
    "e2 = False\n",
    "e3 = e1 and e2\n",
    "e4 = e1 or e2\n",
    "e5 = not e4\n",
    "print(\"e1={0}, e2={1}, e3={2}, e4={3}, e5={4}\".format(e1,e2,e3,e4,e5))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 五 空值\n",
    "空值是Python里一个特殊的值，用None表示。\n",
    "<b>None不能理解为0</b>，因为0是有意义的，而None是一个特殊的空值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "None\n"
     ]
    }
   ],
   "source": [
    "f1 = None\n",
    "print(f1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "f1=None \n",
    "But None is not the same as zero\n",
    "the N must be in capitals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 请用字符串表示出 Learn Python\n",
    "a=\"Learn Python\"\n",
    "type(a)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'I am the \"best\" '"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 请用字符串表示出 “I am the \"best\" ”\n",
    "s='I am the \"best\" '\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "False\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 计算以下表达式的布尔值（注意==表示判断是否相等）\n",
    "print(100 < 99) \n",
    "print(100 < 99 and 0 < 1)\n",
    "True == (2 > 3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 语法解释\n",
    "\n",
    "### print\n",
    "\n",
    "print语句可以向屏幕上输出指定的文字\n",
    "\n",
    "print语句也可以跟上多个字符串，用逗号“,”隔开，就可以连成一串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a1 = 1\n",
    "a2 = 100\n",
    "a3 = -80\n",
    "a4 = 0\n",
    "print(a1, a2, a3, a4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Python的注释\n",
    "\n",
    "任何时候，我们都可以给程序加上注释。注释是用来说明代码的，给自己或别人看，而程序运行的时候，Python解释器会直接忽略掉注释，所以，有没有注释不影响程序的执行结果，但是影响到别人能不能看懂你的代码。\n",
    "\n",
    "Python的注释以 ** # ** 开头，后面的文字直到行尾都算注释"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 我是注释\n",
    "print('注释')  # 我也是注释\n",
    "# print('我不行运行')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### import\n",
    "\n",
    "Python语言中import的使用很简单，直接使用import module_name语句导入即可。这里我主要写一下\"import\"的本质\n",
    "\n",
    "模块（module）：用来从逻辑（实现一个功能）上组织Python代码（变量、函数、类），本质就是*.py文件。文件是物理上组织方式\"module_name.py\"，模块是逻辑上组织方式\"module_name\"。\n",
    "\n",
    "包（package）：定义了一个由模块和子包组成的Python应用程序执行环境，本质就是一个有层次的文件目录结构（必须带有一个__init__.py文件）\n",
    "\n",
    "#### 使用适当的模块，可以大量减少代码的编写，这也是Python一个大的优点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 引入数学模块　math\n",
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.141592653589793\n",
      "45.0\n",
      "16.0\n"
     ]
    }
   ],
   "source": [
    "print(math.pi)  # 圆周率\n",
    "print(math.degrees(math.pi/4))  # 转为度数\n",
    "print(math.pow(2, 4))  # 返回x的y次方，即x**y\n",
    "math."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### 遇到不懂，怎样查找答案\n",
    "\n",
    "使用 ? 查看函数的帮助："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "sum?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math\n",
    "math.sin?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module math:\n",
      "\n",
      "NAME\n",
      "    math\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.6/library/math\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "DESCRIPTION\n",
      "    This module is always available.  It provides access to the\n",
      "    mathematical functions defined by the C standard.\n",
      "\n",
      "FUNCTIONS\n",
      "    acos(...)\n",
      "        acos(x)\n",
      "        \n",
      "        Return the arc cosine (measured in radians) of x.\n",
      "    \n",
      "    acosh(...)\n",
      "        acosh(x)\n",
      "        \n",
      "        Return the inverse hyperbolic cosine of x.\n",
      "    \n",
      "    asin(...)\n",
      "        asin(x)\n",
      "        \n",
      "        Return the arc sine (measured in radians) of x.\n",
      "    \n",
      "    asinh(...)\n",
      "        asinh(x)\n",
      "        \n",
      "        Return the inverse hyperbolic sine of x.\n",
      "    \n",
      "    atan(...)\n",
      "        atan(x)\n",
      "        \n",
      "        Return the arc tangent (measured in radians) of x.\n",
      "    \n",
      "    atan2(...)\n",
      "        atan2(y, x)\n",
      "        \n",
      "        Return the arc tangent (measured in radians) of y/x.\n",
      "        Unlike atan(y/x), the signs of both x and y are considered.\n",
      "    \n",
      "    atanh(...)\n",
      "        atanh(x)\n",
      "        \n",
      "        Return the inverse hyperbolic tangent of x.\n",
      "    \n",
      "    ceil(...)\n",
      "        ceil(x)\n",
      "        \n",
      "        Return the ceiling of x as an Integral.\n",
      "        This is the smallest integer >= x.\n",
      "    \n",
      "    copysign(...)\n",
      "        copysign(x, y)\n",
      "        \n",
      "        Return a float with the magnitude (absolute value) of x but the sign \n",
      "        of y. On platforms that support signed zeros, copysign(1.0, -0.0) \n",
      "        returns -1.0.\n",
      "    \n",
      "    cos(...)\n",
      "        cos(x)\n",
      "        \n",
      "        Return the cosine of x (measured in radians).\n",
      "    \n",
      "    cosh(...)\n",
      "        cosh(x)\n",
      "        \n",
      "        Return the hyperbolic cosine of x.\n",
      "    \n",
      "    degrees(...)\n",
      "        degrees(x)\n",
      "        \n",
      "        Convert angle x from radians to degrees.\n",
      "    \n",
      "    erf(...)\n",
      "        erf(x)\n",
      "        \n",
      "        Error function at x.\n",
      "    \n",
      "    erfc(...)\n",
      "        erfc(x)\n",
      "        \n",
      "        Complementary error function at x.\n",
      "    \n",
      "    exp(...)\n",
      "        exp(x)\n",
      "        \n",
      "        Return e raised to the power of x.\n",
      "    \n",
      "    expm1(...)\n",
      "        expm1(x)\n",
      "        \n",
      "        Return exp(x)-1.\n",
      "        This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.\n",
      "    \n",
      "    fabs(...)\n",
      "        fabs(x)\n",
      "        \n",
      "        Return the absolute value of the float x.\n",
      "    \n",
      "    factorial(...)\n",
      "        factorial(x) -> Integral\n",
      "        \n",
      "        Find x!. Raise a ValueError if x is negative or non-integral.\n",
      "    \n",
      "    floor(...)\n",
      "        floor(x)\n",
      "        \n",
      "        Return the floor of x as an Integral.\n",
      "        This is the largest integer <= x.\n",
      "    \n",
      "    fmod(...)\n",
      "        fmod(x, y)\n",
      "        \n",
      "        Return fmod(x, y), according to platform C.  x % y may differ.\n",
      "    \n",
      "    frexp(...)\n",
      "        frexp(x)\n",
      "        \n",
      "        Return the mantissa and exponent of x, as pair (m, e).\n",
      "        m is a float and e is an int, such that x = m * 2.**e.\n",
      "        If x is 0, m and e are both 0.  Else 0.5 <= abs(m) < 1.0.\n",
      "    \n",
      "    fsum(...)\n",
      "        fsum(iterable)\n",
      "        \n",
      "        Return an accurate floating point sum of values in the iterable.\n",
      "        Assumes IEEE-754 floating point arithmetic.\n",
      "    \n",
      "    gamma(...)\n",
      "        gamma(x)\n",
      "        \n",
      "        Gamma function at x.\n",
      "    \n",
      "    gcd(...)\n",
      "        gcd(x, y) -> int\n",
      "        greatest common divisor of x and y\n",
      "    \n",
      "    hypot(...)\n",
      "        hypot(x, y)\n",
      "        \n",
      "        Return the Euclidean distance, sqrt(x*x + y*y).\n",
      "    \n",
      "    isclose(...)\n",
      "        isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) -> bool\n",
      "        \n",
      "        Determine whether two floating point numbers are close in value.\n",
      "        \n",
      "           rel_tol\n",
      "               maximum difference for being considered \"close\", relative to the\n",
      "               magnitude of the input values\n",
      "            abs_tol\n",
      "               maximum difference for being considered \"close\", regardless of the\n",
      "               magnitude of the input values\n",
      "        \n",
      "        Return True if a is close in value to b, and False otherwise.\n",
      "        \n",
      "        For the values to be considered close, the difference between them\n",
      "        must be smaller than at least one of the tolerances.\n",
      "        \n",
      "        -inf, inf and NaN behave similarly to the IEEE 754 Standard.  That\n",
      "        is, NaN is not close to anything, even itself.  inf and -inf are\n",
      "        only close to themselves.\n",
      "    \n",
      "    isfinite(...)\n",
      "        isfinite(x) -> bool\n",
      "        \n",
      "        Return True if x is neither an infinity nor a NaN, and False otherwise.\n",
      "    \n",
      "    isinf(...)\n",
      "        isinf(x) -> bool\n",
      "        \n",
      "        Return True if x is a positive or negative infinity, and False otherwise.\n",
      "    \n",
      "    isnan(...)\n",
      "        isnan(x) -> bool\n",
      "        \n",
      "        Return True if x is a NaN (not a number), and False otherwise.\n",
      "    \n",
      "    ldexp(...)\n",
      "        ldexp(x, i)\n",
      "        \n",
      "        Return x * (2**i).\n",
      "    \n",
      "    lgamma(...)\n",
      "        lgamma(x)\n",
      "        \n",
      "        Natural logarithm of absolute value of Gamma function at x.\n",
      "    \n",
      "    log(...)\n",
      "        log(x[, base])\n",
      "        \n",
      "        Return the logarithm of x to the given base.\n",
      "        If the base not specified, returns the natural logarithm (base e) of x.\n",
      "    \n",
      "    log10(...)\n",
      "        log10(x)\n",
      "        \n",
      "        Return the base 10 logarithm of x.\n",
      "    \n",
      "    log1p(...)\n",
      "        log1p(x)\n",
      "        \n",
      "        Return the natural logarithm of 1+x (base e).\n",
      "        The result is computed in a way which is accurate for x near zero.\n",
      "    \n",
      "    log2(...)\n",
      "        log2(x)\n",
      "        \n",
      "        Return the base 2 logarithm of x.\n",
      "    \n",
      "    modf(...)\n",
      "        modf(x)\n",
      "        \n",
      "        Return the fractional and integer parts of x.  Both results carry the sign\n",
      "        of x and are floats.\n",
      "    \n",
      "    pow(...)\n",
      "        pow(x, y)\n",
      "        \n",
      "        Return x**y (x to the power of y).\n",
      "    \n",
      "    radians(...)\n",
      "        radians(x)\n",
      "        \n",
      "        Convert angle x from degrees to radians.\n",
      "    \n",
      "    sin(...)\n",
      "        sin(x)\n",
      "        \n",
      "        Return the sine of x (measured in radians).\n",
      "    \n",
      "    sinh(...)\n",
      "        sinh(x)\n",
      "        \n",
      "        Return the hyperbolic sine of x.\n",
      "    \n",
      "    sqrt(...)\n",
      "        sqrt(x)\n",
      "        \n",
      "        Return the square root of x.\n",
      "    \n",
      "    tan(...)\n",
      "        tan(x)\n",
      "        \n",
      "        Return the tangent of x (measured in radians).\n",
      "    \n",
      "    tanh(...)\n",
      "        tanh(x)\n",
      "        \n",
      "        Return the hyperbolic tangent of x.\n",
      "    \n",
      "    trunc(...)\n",
      "        trunc(x:Real) -> Integral\n",
      "        \n",
      "        Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method.\n",
      "\n",
      "DATA\n",
      "    e = 2.718281828459045\n",
      "    inf = inf\n",
      "    nan = nan\n",
      "    pi = 3.141592653589793\n",
      "    tau = 6.283185307179586\n",
      "\n",
      "FILE\n",
      "    /opt/conda/lib/python3.6/lib-dynload/math.cpython-36m-x86_64-linux-gnu.so\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Help\n",
    "# math的功能\n",
    "help(math)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function append:\n",
      "\n",
      "append(...) method of builtins.list instance\n",
      "    L.append(object) -> None -- append object to end\n",
      "\n"
     ]
    }
   ],
   "source": [
    "l = []\n",
    "help(l.append)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['__add__',\n",
       " '__class__',\n",
       " '__contains__',\n",
       " '__delattr__',\n",
       " '__delitem__',\n",
       " '__dir__',\n",
       " '__doc__',\n",
       " '__eq__',\n",
       " '__format__',\n",
       " '__ge__',\n",
       " '__getattribute__',\n",
       " '__getitem__',\n",
       " '__gt__',\n",
       " '__hash__',\n",
       " '__iadd__',\n",
       " '__imul__',\n",
       " '__init__',\n",
       " '__init_subclass__',\n",
       " '__iter__',\n",
       " '__le__',\n",
       " '__len__',\n",
       " '__lt__',\n",
       " '__mul__',\n",
       " '__ne__',\n",
       " '__new__',\n",
       " '__reduce__',\n",
       " '__reduce_ex__',\n",
       " '__repr__',\n",
       " '__reversed__',\n",
       " '__rmul__',\n",
       " '__setattr__',\n",
       " '__setitem__',\n",
       " '__sizeof__',\n",
       " '__str__',\n",
       " '__subclasshook__',\n",
       " 'append',\n",
       " 'clear',\n",
       " 'copy',\n",
       " 'count',\n",
       " 'extend',\n",
       " 'index',\n",
       " 'insert',\n",
       " 'pop',\n",
       " 'remove',\n",
       " 'reverse',\n",
       " 'sort']"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# dir\n",
    "dir(l)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 善用搜索引擎\n",
    "\n",
    "百度，bing，谷歌 ： python + 库名字 （例子）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Review\n",
    "\n",
    "### Ex1\n",
    "\n",
    "1. What is the output of the following code?\n",
    "\n",
    "```\n",
    "var = \"James\" * 2  * 3\n",
    "print(var)\n",
    "```\n",
    "\n",
    "2. What is the output of the following\n",
    "\n",
    "```\n",
    "x = 36 / 4 * (3 +  2) * 4 + 2\n",
    "print(x)\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
